Top 10 Xamarin Tips and Traps by Charles Pluta

Top 10 Xamarin Tips and Traps by Charles Pluta

Author:Charles Pluta [Pluta, Charles]
Language: eng
Format: azw3
Publisher: Infragistics
Published: 2017-03-24T04:00:00+00:00


Listing 27.10: A factory function returning an object of DataService

Listing 27.11 specifies this method in the providers option.

Listing 27.11: providers using useFactory

Conclusion

This chapter demonstrated how Services can be registered in different ways in Angular 2 and how their objects can be controlled using different options available in the provider registration. These features make the DI system in Angular extremely powerful and flexible. Some of these features help in mocking services in unit tests as well. We will cover these features in the chapters on unit testing.



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.